<h1>Listing stock_loggings</h1>

<table border="1">
  <thead>
    <tr>
      <th>Created at</th>
      <th>Drug</th>
      <th>Inventory</th>
      <th>Quantity</th>
      <th>Stock logging category</th>
      <th colspan="3"></th>
    </tr>
  </thead>

  <tbody>
    <% @stock_loggings.each do |stock_logging| %>
      <tr>
        <td><%= stock_logging.created_at %></td>
        <% stock_logging.drugs.each do |d| %>
        <td><%= d.name %></td>
        <% end %>
        <td><%= stock_logging.inventory.name %></td>
        <td><%= stock_logging.quantity %></td>
        <td><%= stock_logging.stock_logging_category.name %></td>
        
        <td><%= link_to 'Show', stock_logging %></td>
        <td><%= link_to 'Edit', edit_stock_logging_path(stock_logging) %></td>
        <td><%= link_to 'Destroy', stock_logging, method: :delete, data: { confirm: 'Are you sure?' } %></td>
      </tr>
    <% end %>
  </tbody>
</table>

<br>

<%= link_to 'New Stock logging', new_stock_logging_path %>
